import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import java.io.IOException;

public class CreateTable {
    public static void main(String[] args) throws IOException {
        Configuration conf=HBaseConfiguration.create();
        conf.set("hbase.zookeeper.quorum","192.168.75.11");


        HBaseAdmin admin = new HBaseAdmin(conf);
        HTableDescriptor table = new HTableDescriptor(TableName.valueOf("student"));

        HColumnDescriptor cf1 = new HColumnDescriptor("info");
        HColumnDescriptor cf2 = new HColumnDescriptor("status");

        table.addFamily(cf1);
        table.addFamily(cf2);


        if(admin.tableExists("student")){
            System.out.println("Table already exists");
        }else{
            admin.createTable(table);

        }
        System.out.println("=> hbase::Table - student");




    }
}
